﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Inheritance_abstract_polymorphism
{
    class SimpleQuiz : QuizBase
    {
        private string _correctAnswer;
        private string _inputAnswer;

        public SimpleQuiz(string question, QuizType type, QuizDifficulty difficulty, string correctAnswer)
            : base(question, type, difficulty)
        {
            _correctAnswer = correctAnswer;
        }

        public override void ReadAnswer()
        {
            do 
            {
                _inputAnswer = Console.ReadLine().Trim();
                if(string.IsNullOrEmpty(_inputAnswer))
                {
                    Console.WriteLine("Ban chua nhap cau tra loi! Hay nhap cau tra loi");
                }
            } 
            while (string.IsNullOrEmpty(_inputAnswer));
        }

        public override bool IsCorrect()
        {
            if (_inputAnswer.ToLower().Equals(_correctAnswer.ToLower()))
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        public override void ShowQuestion()
        {
            Console.WriteLine("Day la cau tra loi truc tiep. Ban hay nhap cau tra loi vao.");
            Console.WriteLine(this.Question);
        }
    }
}
